from datetime import datetime
from sqlalchemy import Integer, String, Column, Boolean, DateTime
from public.db import db
from marshmallow import Schema, fields


class UserSchema(Schema):
    id = fields.Integer()
    username = fields.String()
    # password = fields.String()
    phone = fields.String()


class UserModel(db.Model):
    __tablename__ = "user"
    id = Column(Integer, primary_key=True, autoincrement=True)
    username = Column(String(12), nullable=False, unique=True)
    password = Column(String(64), nullable=False)
    phone = Column(String(11))
    isdelete = Column(Boolean, default=False)
    rdatetime = Column(DateTime, default=datetime.now)


# if __name__ == '__main__':
#     from manager import db, app
#     with app.app_context():
#         db.create_all()
    # 创建表
    # db.create_all()
    # 删除表
    # db.drop_all()
